<?php
// +-------------+-------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
// | Field       | Type                                                                                                  | Null | Key | Default | Extra          |
// +-------------+-------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
// | id          | int(11)                                                                                               | NO   | PRI | NULL    | auto_increment |
// | user_id     | int(11) unsigned                                                                                      | NO   |     | 0       |                |
// | article_id  | int(11) unsigned                                                                                      | NO   |     | 0       |                |
// | user_name   | varchar(50)                                                                                           | NO   |     |         |                |
// | gender      | enum('secret','male','female','unknown')                                                              | YES  |     | secret  |                |
// | education   | enum('secret','zhongji','zhongzhuan','gaozhong','dazhuan','benke','shuoshi','boshi','boshihou','mba') | YES  |     | secret  |                |
// | email       | varchar(100)                                                                                          | YES  |     |         |                |
// | mobile      | varchar(15)                                                                                           | YES  |     |         |                |
// | member_id   | int(11) unsigned                                                                                      | YES  |     | 0       |                |
// | create_time | int(11) unsigned                                                                                      | YES  |     | 0       |                |
// | update_time | int(11) unsigned                                                                                      | YES  |     | 0       |                |
// | delete_time | int(11) unsigned                                                                                      | YES  |     | 0       |                |
// +-------------+-------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
namespace app\common\validate;

use think\Validate;

class Subscribe extends Validate
{
    protected $rule = [
        // "user_id" => "require|gt:0",
        "article_id" => "require|gt:0",
        "user_name" => "require|min:2|max:50",
        // "gender" => "require",
        // "education" => "require",
        // "email" => "require|email",
        "mobile" => "require|length:11",
    ];

    protected $field = [
        "user_id" => "申请用户",
        "article_id" => "申报项目",
        "user_name" => "姓名",
        // "gender" => "性别",
        // "education" => "最高学历",
        // "email" => "邮箱",
        "mobile" => "手机号",
    ];

    protected $message = [
        "user_id.require" => "申请用户不能为空",
        "user_id.gt" => "申请用户不能为空",
        "article_id.require" => "申报项目不能为空",
        "article_id.gt" => "申报项目不能为空",
        "user_name.require" => "姓名不能为空",
        "user_name.min" => "姓名长度必须在2-50个字符之间",
        "user_name.max" => "姓名长度必须在2-50个字符之间",
        "gender.require" => "性别不能为空",
        // "education.require" => "最高学历不能为空",
        // "email.require" => "邮箱不能为空",
        // "email.email" => "邮箱格式不正确",
        "mobile.require" => "手机号不能为空",
        "mobile.length" => "手机号格式不正确",
    ];
}